/**
 * Copyright (C) 2010, 2011 Neofonie GmbH
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package eu.dicodeproject.blogimport.filereader;

import javax.xml.transform.Source;

/**
 * This interface defines a source for files that contain XML that is returned
 * as {@link Source} object for later parsing with a BlogParser.
 * 
 * 
 * 
 */
public interface FileSource {

	/**
	 * This method checks whether the last refreshed state of the source still
	 * has new {@link Source} objects.
	 * 
	 * @return true if there are more possible documents that shall be returned
	 *         as {@link Source} object, false if no more documents are
	 *         available since the last refresh
	 */
	boolean hasNext();

	/**
	 * This method returns the next document as {@link String} or
	 * null if hasNext() would return false.
	 * 
	 * @return the next document as {@link String} object or null if
	 *         nothing present
	 */
	String next();

	/**
	 * Implementations of this method should initialize whatever file system
	 * access is needed within this method. This could mean that an initial
	 * queue is build up, which is latterly used for the hasNext() and next()
	 * methods.
	 * 
	 * @return true when we successfully refreshed the internal filesystem
	 *         representation and added new files to the internal queue
	 */
	boolean init();
	

	/**
	 * This method informs the {@link FileSource} to gracefully shutdown. So all
	 * file system operations can be terminated before the application really
	 * quits.
	 */
	void shutdown();
	
}
